package com.briup.estore.mapper;

import java.math.BigInteger;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import com.briup.estore.bean.Book;

@Mapper
public interface IBookMapper {

	@Select("select b.id book_id,b.name book_name,b.price book_price,b.author book_author,"
			+ "b.publisher book_publisher,b.pubdate book_pubdate,b.description book_description, "
			+ "b.category_id book_category_id,b.images book_images,b.click book_click,"
			+ "C2.id c2_id,C2.name c2_name,C2.description c2_description "
			+ "from es_book b,es_category c1,es_category c2 "
			+ "where b.category_id = C1.id and C1.CATEGORY_ID = C2.id and b.id = #{id} ")
	@ResultMap("com.briup.estore.mapper.ICategoryMapper.bookResultMap")
	Book findBookById(BigInteger id);

	@Select("select distinct publisher from ES_BOOK ")
	List<String> findAllPublisher();
}
